package com.trade.module.base.service.impl;

import com.trade.module.base.entity.UserRole;
import com.trade.module.base.repository.UserRepository;
import com.trade.module.base.repository.UserRoleRepository;
import com.trade.module.base.service.UserRoleService;
import lombok.extern.log4j.Log4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.transaction.Transactional;

/**
 * Class Description:用户角色服务层
 *
 * @Version v1.0 2017/4/22 23:40
 * @JDK version 1.8.0_51
 * @Author zfb
 */
@Log4j
@Service
public class UserRoleServiceImpl implements UserRoleService {

    /**
     * Field description ：注入用户角色管理操作层接口类
     */
    @Autowired
    private UserRoleRepository userrolerepository;
    /**
     * Field description ：注入用户数据库操作层接口类
     */
    @Autowired
    private UserRepository userRepository;

    @Override
    @Transactional
    public UserRole save(UserRole userRole) {
        if(userRole == null){
            return null;
        }
        return userrolerepository.save(userRole);
    }
}
